$(document).ready(function() {
	isLogin();
	getUser();
	logout();
});
function getUser() {
	var str = "<small>欢迎,</small>";
	$.get("127.0.0.1:8080/datacompute/getUserInfo", function(datas, status) {
		str += datas.data[0].name;
		$(".user-info").html(str);
	});
}
function logout() {
	$("#logout").click(function() {
		$.get("127.0.0.1:8080/datacompute/logout", function(data, status) {
			if (data.code == 0)
				window.location.href = "login.html";
			else
				alert(data.message);
		});

	});
}
function isLogin() {
	$.get("127.0.0.1:8080/datacompute/isLogin", function(data, status) {
		if (data.code != 0) {
			window.location.href = "login.html";
		}
	});
}